FROM keymetrics/pm2:latest-alpine

# Bundle APP files
COPY src src/
COPY conf conf/
COPY package.json .
COPY ecosystem.config.js .
COPY nest-cli.json .
COPY prettier.config.js .
COPY tsconfig.build.json .
COPY lint-staged.config.js .
COPY tsconfig.json .
COPY .env.production .

# Install app dependencies
ENV NPM_CONFIG_LOGLEVEL warn
RUN npm install
RUN npm run build

RUN mkdir /logs

CMD [ "pm2-runtime", "start", "ecosystem.config.js", "--env", "production" ]
